package com.example.bob.dao;


import com.example.bob.model.UserInfo;
import com.example.bob.model.vo.UserInfoVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    //注册用户
    //此时会写入密码，需要加盐
    @Insert("insert into userinfo(username,password) values(#{username},#{password})")
    int addUserInfo(UserInfo userInfo);

    //用户登录
    //此时需要对比密码，需要解密
    @Select("select * from userinfo where username = #{username}")
    UserInfo getUserByName(String username);


    @Select("select * from userinfo where id=#{uid}")
    UserInfoVO getUserById(int uid);
}
